package dialer.ws.base.dao;

import java.io.Serializable;
import java.util.List;

import dialer.ws.base.exception.EntityException;
import dialer.ws.base.exception.EntityExistException;
import dialer.ws.base.exception.EntityNoFoundException;
import dialer.ws.base.query.NamedQueryParameter;
import dialer.ws.base.query.QueryParameter;

public interface GenericDAO<T, PK extends Serializable> {

	public List<T> findAll() throws EntityException;

	public List<T> findByNamedQuery(String queryName) throws EntityException;

	public List<T> findByNamedQueryNamedParameter(String queryName, NamedQueryParameter... args) throws EntityException;

	public List<T> findByNamedQueryPositionalParameter(String queryName, QueryParameter... args) throws EntityException;
	
	public List<T> findNamedParameter(String query, NamedQueryParameter... args) throws EntityException;

	public List<T> findPositionalParameter(String query, QueryParameter... args) throws EntityException;
	
	public Object findByNamedQueryNamedParameterReturnObject(String queryName, NamedQueryParameter... args) throws EntityException;

	public T findByPk(PK pk) throws EntityNoFoundException;

	public T findInstanceByNamedQuery(String queryName) throws EntityException;

	public T findInstanceByNamedQueryNamedParameter(String queryName, NamedQueryParameter... args)
			throws EntityNoFoundException, EntityException;

	public T findInstanceByNamedQueryPositionalParameter(String queryName, QueryParameter... args)
			throws EntityException;

	public void flush() throws EntityException;

	public Object merge(Object object) throws EntityException;

	public Object persist(Object object) throws EntityExistException, EntityException;
	
	public Object saveOrUpdate(Object object) throws EntityExistException, EntityException;

	public void remove(Object object) throws EntityException;

	public boolean contains(Object object);
	
	public void clear() throws EntityException;
	
}